#include	"Stream.hpp"
#include	<iostream>

_BOF_ZIA_API_

Stream::Stream()
{
}

Stream::~Stream()
{
}

int				Stream::callReader()
{
	int			ret = 0;

	return (ret);
}

bool			Stream::canRead() const
{
	bool		ret = false;
	
	if (this->_master->_body.size() != 0)
		ret = true;
	return (ret);
}
void			Stream::write(const std::string& str)
{
	this->_master->_body += str;
	return ;
}
void			Stream::write(const char *buff, size_t buffSize)
{
	this->_master->_body.append(buff, buffSize);
	return ;
}
size_t			Stream::read(char * buff, size_t maxBuffSize)
{
	size_t		ret;

	ret = this->_master->_body.copy(buff, maxBuffSize, 0);
	return (ret);
}

void			Stream::drop()
{
	this->_master->_body = "";
	return ;
}

void			Stream::dropAll()
{
	this->_master->_body = "";
	return ;
}
void			Stream::flush()
{
	/*Call the reader*/
	return ;
}
void			Stream::close()
{
	this->mClosed = true;
	return ;
}
void			Stream::forceClose()
{
	this->mClosed = true;
	return ;
}

void			Stream::setMsg(Message *msg)
{
	this->_master = msg;
	return ;
}
_EOF_ZIA_API_